package com.geline.luckysheet.controller;

import com.geline.luckysheet.util.LuckySheetExcelUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 下载excel
 * @author: mengxin
 * @date: 2022/10/12 15:24
 */
@RestController
@RequestMapping("/excel")
@Slf4j
public class ExcelController {

    /**
     * 將在線Excel導出下載
     * 参考项目：lmc-tools/tools-excel
     * @param excelData excel数据
     * @return
     */
    @PostMapping("/downFile")
    public String downFile(String excelData) {
        String fileNameNew = "test_2022.xlsx";//保存的文件名
        String path = LuckySheetExcelUtil.exportLuckySheetXlsxByPOI(fileNameNew, excelData);
        return path;
    }
}
